import { AxiosRequestConfig, AxiosResponse } from "axios"

export interface RequestInterceptors {
  // 请求拦截
  requestInterceptors?: (config: AxiosRequestConfig) => AxiosRequestConfig
  requestInterceptorsCatch?: (err: any) => any
  // 响应拦截
  responseInterceptors?: <T = AxiosResponse<any, any>>(response: T) => T
  responseInterceptorsCatch?: (err: any) => any
}
// 继承 AxiosRequestConfig 自定义响应拦截器
export interface RequestConfig extends AxiosRequestConfig {
  interceptors?: RequestInterceptors
}

// 取消请求
export interface CancelRequestSource {
  [index: string]: () => void
}
